package com.cn.web;

import com.cn.entity.User;
import com.cn.sender.HelloSender;
import com.cn.sender.HelloSenderCallBack;
import com.cn.sender.RabbitMqDelaySender;
import lombok.extern.java.Log;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by chenyuncong on 2019/5/22.
 */
@RestController
@RequestMapping("send")
public class SendInfoWeb {
    @Autowired
    private AmqpTemplate template;
    @Autowired
    private HelloSender helloSender;
    @Autowired
    private RabbitMqDelaySender rabbitMqDelaySender;
    @Autowired
    private HelloSenderCallBack helloSenderCallBack;

    @GetMapping("testRabbit")
    public void testRabbit() {
        helloSender.send();
    }

    @GetMapping("testRabbit2")
    public void testRabbit2() {
        helloSender.sendUser();
    }

    @GetMapping("testRabbit3")
    public void testRabbit3() {
        helloSender.sendTopic();
    }


    @GetMapping("send")
    public void send() {
        helloSenderCallBack.send();
    }

    @GetMapping("sendCallback")
    public void sendCallback() {
        helloSenderCallBack.sendCallback();
    }

    @GetMapping("delaySender")
    public void delaySender(){
        rabbitMqDelaySender.Send("小明同学：","10000");
    }
}
